home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / tpapi.exe / EXAMPLES / GWSINFO.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-14  |  3KB  |  116 lines

  1. {***************************************************************************}
  2. {** Program : GWSINFO                                                     **}
  3. {***************************************************************************}
  4. {** Version : 1.0             ** Started :           ** Ended :           **}
  5. {***************************************************************************}
  6. {******************************** Description ******************************}
  7. {***************************************************************************}
  8. {** Program to get selected information about the object                  **}
  9. {**                                                                       **}
  10. {**                                                                       **}
  11. {**                                                                       **}
  12. {**                                                                       **}
  13. {**                                                                       **}
  14. {**                                                                       **}
  15. {**                                                                       **}
  16. {***************************************************************************}
  17. {******************************** Information ******************************}
  18. {***************************************************************************}
  19. {**                                                                       **}
  20. {**                                                                       **}
  21. {**                                                                       **}
  22. {**                                                                       **}
  23. {**                                                                       **}
  24. {**                                                                       **}
  25. {***************************************************************************}
  26.  
  27. {$X+}
  28.  
  29. program GWSINFO;
  30.  
  31. uses
  32.  
  33.   {$IFDEF WINDOWS}
  34.   wincrt,
  35.   {$ELSE}
  36.   crt,
  37.   {$ENDIF}
  38.   nwvar,
  39.   nwerror,
  40.   nwbindry,
  41.   nwconn,
  42.   nwmisc
  43.   ;
  44.  
  45. var
  46.  
  47.   BS : BinderyOBJ;
  48.   CS : ConnectionOBJ;
  49.   MS : MiscFuncOBJ;
  50.  
  51. procedure Initialise;
  52.  
  53. begin
  54.  
  55.   BS.Init (true);
  56.   CS.Init (false);
  57.   MS.Init (true);
  58.  
  59. end; {initialise}
  60.  
  61. {***}
  62.  
  63. procedure Done;
  64.  
  65. begin
  66.  
  67.   BS.Done;
  68.   CS.Done;
  69.   MS.Done;
  70.  
  71. end; {Done}
  72.  
  73. {***}
  74.  
  75. procedure DisplayInfo;
  76.  
  77. var
  78.  
  79.   ObjName  : TObjectName;
  80.   ObjType  : OT_BinderyType;
  81.   ObjID    : OT_BinderyID;
  82.   ObjLT    : TByte7Array;
  83.   StatAddr : TByte6Array;
  84.   NetNum   : TByte4Array;
  85.   SockNum  : word;
  86.   ConnType : byte;
  87.  
  88. begin
  89.  
  90.   clrscr;
  91.   writeln;
  92.   with CS, MS do
  93.     begin
  94.  
  95.       GetConnectionInformation (GetConnectionNumber, ObjName, ObjType, ObjID, ObjLT);
  96.       if ObjName = '' then
  97.         ObjName := 'NOT-LOGGED-IN';
  98.       writeln ('You are connection number ', GetConnectionNumber, ' on ', GetDefaultFileServerName);
  99.       writeln ('Your login name is ', ObjName);
  100.       GetInternetAddress (GetConnectionNumber, NetNum, StatAddr, SockNum, ConnType);
  101.       writeln ('Internet address : ', ConvertNetworkNumber (NetNum), ':',
  102.                ConvertNodeAddress (StatAddr), ':', HexString (SockNum, 4));
  103.  
  104.     end;
  105.  
  106. end; {DisplayInfo}
  107.  
  108. {***}
  109.  
  110. begin
  111.  
  112.   Initialise;
  113.   DisplayInfo;
  114.   Done;
  115.  
  116. end.